#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-bionic AS base
WORKDIR /app
EXPOSE 80

#设置编码为UTF-8
ENV LANG C.UTF-8
#解决时区问题
ENV TZ=Asia/Shanghai
ENV DEBIAN_FRONTEND noninteractive
# 安装 tzdata 软件包
RUN apt-get update 
RUN apt-get install -y tzdata 
RUN ln -fs /usr/share/zoneinfo/$TZ  /etc/localtime 
RUN rm -rf /var/lib/apt/lists/ 
RUN dpkg-reconfigure -f noninteractive tzdata
#解决时区问题

FROM mcr.microsoft.com/dotnet/core/sdk:3.1-bionic AS build
WORKDIR /src
COPY ["Quartz.Manage/Quartz.Manage.csproj", "Quartz.Manage/"]
COPY ["Quartz.Service/Quartz.Service.csproj", "Quartz.Service/"]
COPY ["Common/Common.csproj", "Common/"]
COPY ["MongoDB/MongoDB.csproj", "MongoDB/"]
RUN dotnet restore "Quartz.Manage/Quartz.Manage.csproj"
COPY . .
WORKDIR "/src/Quartz.Manage"
RUN dotnet build "Quartz.Manage.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "Quartz.Manage.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "Quartz.Manage.dll"]